#ifndef _DANIEL_KERR_GLSTAR_H
#define _DANIEL_KERR_GLSTAR_H

#include "driver.h"

// Star Defines
#define MAX_STAR_WIDTH 0.03
#define STAR_BUFFER 5.0

struct Star
{
	GLfloat posx,posy,posz;
	GLfloat red,green,blue;
	GLfloat size;
};

class Star_C
{
	public:
		void setStars(int scount,GLfloat rad,GLfloat y_val)
		{
			Star temp;
			for(int i=0;i<scount;++i)
			{
				GLfloat pm_X = rad + STAR_BUFFER; 
				GLfloat pm_Y = y_val + STAR_BUFFER;
				GLfloat pm_Z = rad + STAR_BUFFER;

				temp.posx = (((float)rand()/RAND_MAX)*pm_X*2.0)-(pm_X);
				temp.posy = (((float)rand()/RAND_MAX)*pm_Y*2.0)-(pm_Y);
				temp.posz = (((float)rand()/RAND_MAX)*pm_Z*2.0)-(pm_Z);

				temp.red = ((float)rand()/RAND_MAX);
				temp.green = ((float)rand()/RAND_MAX);
				temp.blue = ((float)rand()/RAND_MAX);

				temp.size = ((float)rand()/RAND_MAX)*MAX_STAR_WIDTH;
				belt.push_back(temp);
			}
		}

		void set2Dstars(int scount)
		{
			Star temp;
			for(int i = 0; i < scount; i++)
			{
				temp.blue = temp.red = temp.green = 1.0;
				temp.posx = rand()%800;
				temp.posy = rand()%600;
				temp.posz = (rand()%10);
				temp.size = 1;
				belt.push_back(temp);
			}
		}

		void close()
		{belt.clear();}

		int NOS() {return belt.size();}

		GLfloat sx(int i)	{return belt[i].posx;}				// X coordinate
		GLfloat sy(int i)	{return belt[i].posy;}				// Y coordinate
		GLfloat sz(int i)	{return belt[i].posz;}				// Z coordinate
		GLfloat sr(int i )	{return belt[i].red;}				// red value
		GLfloat sg(int i)	{return belt[i].green;}				// green value
		GLfloat sb(int i)	{return belt[i].blue;}				// blue value
		GLfloat ss(int i)	{return belt[i].size;}				// size

	private:
		vector <Star> belt;
};

#endif